class Schedule {
    Date start
    Date end
    String location
    Integer seats
    Course course
    static belongsTo = Course;
    static hasMany = [participants : Employee]

    public String toString(){
        return day() + " - From " + startHours() + " To " + endHours() + " ( "+location+")";
    }
    
    public String day(){
       Calendar cal = Calendar.getInstance();
       cal.setTime(start);
       return cal.get(Calendar.YEAR)+"/"+cal.get(Calendar.MONTH)+"/"+cal.get(Calendar.DAY_OF_MONTH);
    }

    public String startHours(){
       Calendar cal = Calendar.getInstance();
       cal.setTime(start);
       return cal.get(Calendar.HOUR)+":"+cal.get(Calendar.MINUTE);
    }
    public String endHours(){
       Calendar cal = Calendar.getInstance();
       cal.setTime(end);
       return cal.get(Calendar.HOUR)+":"+cal.get(Calendar.MINUTE);
    }
}

